home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagg_m.zip / MISC.SWG / 0095_Registration Key Routine.pas < prev    next >
Pascal/Delphi Source File  |  1994-05-25  |  1KB  |  51 lines

  1. {
  2. * In a message originally to All, Brad Larned said:
  3. BL >Hello All!
  4.  
  5. BL >Does anyone have a good registration key routine, they would
  6. BL >be willing to
  7. BL >share, I can download Net-Mail or a response in this message
  8. BL >base will be fine..
  9.  
  10. Here goes.... }
  11.  
  12. type regpass:array[1..23] of byte;
  13.  
  14. function checkregister:boolean;
  15. var
  16.  f:file of regpass;
  17.  p:regpass;
  18.  a,x,y,z,c:word;
  19. begin
  20.  assign(f,'REGISTER.KEY');
  21.  reset(f);
  22.  read(f,p);
  23.  close(f);
  24.  
  25.  
  26.  for a:=1 to 20 do
  27.   begin
  28.    z:=z+p[a];
  29.    x:=x XOR p[a];
  30.    y:=y+NOT(p[a]);
  31.    end;
  32.  c:=z;
  33.  z:=z MOD 256;
  34.  x:=x MOD 256;
  35.  y:=y MOD 256;
  36.  checkregister:=false;
  37.  
  38.  if ((x=p[21]) AND (y=p[22])) AND (z=p[23]) then checkregister:=true;
  39.  if c=0 then checkregister:=false;
  40.  
  41. end;
  42.  
  43. This routine allows you to have both somebody's name and a checksum stored. 
  44. If they don't match up, it appears that it isn't a registered copy.  You can 
  45. stash whatever in the first 20 bytes, and the last three are reserved for a 
  46. chacksum.  This is the routine that I use, and it seems to be pretty 
  47. muck-proof;
  48.  
  49. You can write the routine to create the file and do the checksums yourself.
  50. It's idioticly simple.  C-ya...
  51.